package cn.lingyangwl.agile.pay.common.model.mq;

import cn.lingyangwl.agile.model.module.mq.AbstractMQ;
import cn.lingyangwl.agile.model.module.mq.BaseMqPayload;
import lombok.*;

/**
 * 定义MQ消息格式
 * 业务场景： [ 支付订单超时关闭 ]
 *
 * @author shenguangyang
 */
@Getter
@Setter
public class RefundOrderMQ extends AbstractMQ {
    /**
     * 退款的队列
     */
    public static final String DELAY_QUEUE = "pay_service.refund.delay.queue";

    public static final String DELAY_ROUTING_KEY = "pay_service.refund.delay.routing.key";
    /**
     * 过期时间, ms单位, 上线了请改成30分钟
     */
    public static final Integer TTL = 1000 * 60 * 5;

    public RefundOrderMQ(BaseMqPayload msgPayload) {
        super(msgPayload);
    }

    /**
     * 定义Msg消息载体
     */
    @Data
    @EqualsAndHashCode(callSuper = true)
    @AllArgsConstructor
    public static class MsgPayload extends BaseMqPayload {
        /**
         * 退款订单id
         */
        private String refundOrderId;
    }

    /**
     * 构造MQModel , 一般用于发送MQ时
     */
    public static RefundOrderMQ build(String payOrderId) {
        return new RefundOrderMQ(new MsgPayload(payOrderId));
    }
}
